<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<label>手机号:</label><input type="tel" name="phone" placeholder="建议使用常用手机号" /><span></span>
		<script type="text/javascript">
			var input = document.querySelector("input");
			var span = document.querySelector("span");
			input.addEventListener("blur", function() {
				// console.log(input.value);
				var reg = /^(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/;
				if (reg.test(input.value)) {
					span.innerHTML = "格式正确";
				} else {
					span.innerHTML = "格式错误";
				}
			})
		</script>
	</body>
</html>
